import java.util.*;
import java.io.*;

public class ProteinSeq {
	
	private  ArrayList <Integer> ProteinSequence = new ArrayList<Integer>();
	private  String SeqNo="";
	private double VitScore=0;
	/*
	public static void main(String args[]){
		File file = new File("/Users/OuHan/Desktop/test.fasta");
		BufferedReader br = null;
		int LineNo = 1;
		String line = null;
		try{
			br = new BufferedReader(new FileReader(file));
			while((line = br.readLine()) != null&&LineNo<10){
				//while(LineNo<10){
					if(line.contains(">sp")){
						SeqNo = line.substring(4, line.indexOf('|',4));
					}
					else{
						for(int i = 0; i < line.length(); i++){
							ProteinSequence.add(br.read()-65);
							System.out.print(ProteinSequence.get(i));
							System.out.print(" ");
						}
					//}
					LineNo++;
				}
				//LineNo = 1;
			}
		}catch(IOException e){
			e.printStackTrace();
		}finally{
			try{
				br.close();
			}catch(IOException e1){
			}
		}
	}
	*/
	public void PutProteinSeq(String line){
		if(line.contains(">sp")){
			SeqNo = line.substring(4, line.indexOf('|',4));
		}
		else{
		
			for(int i = 0; i < line.length(); i++){
				char tmp=line.charAt(i);
				if(tmp>='A'&&tmp<'Z'){
					int Element=Transform(tmp);
					ProteinSequence.add(Element);
				}
				//System.out.print(ProteinSequence.get(i));
				//System.out.print(" ");
			}
		//}
		}
	}
	public void ClearSequence(){
		ProteinSequence.clear();
	}
	public int GetAmoni(int Pos){
		int i = ProteinSequence.get(Pos);
		return i;
	
	}
	public int GetArraySize(){
		int i = ProteinSequence.size();
		return i;
	}
	public String GetSeqNo(){
		return SeqNo;
	}
	public double GetVitScore()
	{
		return VitScore;
	}
	public void SetVitScore(int Score){
		VitScore=Score;
	}

	public void Print(){
		System.out.println(SeqNo);
		for(int i=0;i<ProteinSequence.size();i++){
			System.out.print(ProteinSequence.get(i)+",");
		}
	}
	public int Transform(char In){
			switch (In){
			case 'A':
				return 0;
			case 'C':
				return 1;
			case 'D':
				return 2;
			case 'E':
				return 3;
			case 'F':
				return 4;
			case 'G':
				return 5;
			case 'H':
				return 6;
			case 'I':
				return 7;
			case 'K':
				return 8;
			case 'L':
				return 9;
			case 'M':
				return 10;
			case 'N':
				return 11;
			case 'P':
				return 12;
			case 'Q':
				return 13;
			case 'R':
				return 14;
			case 'S':
				return 15;
			case 'T':
				return 16;
			case 'V':
				return 17;
			case 'W':
				return 18;
			case 'Y':
				return 19;
			default:
				return 0;
			}
	}
/*
public static void main(String args[]){
		
		//File file = new File("/Users/OuHan/Desktop/test.fasta");
		//FileInputStream fstream = new FileInputStream("/Users/OuHan/Desktop/test.fasta");
		ProteinSeq Sequence = new ProteinSeq();
		int LineNo = 1;
		try{
		    // Open the file that is the first 
		    // command line parameter
		    FileInputStream fstream = new FileInputStream("/Users/OuHan/Desktop/test.fasta");
		    DataInputStream in = new DataInputStream(fstream);
	        BufferedReader br = new BufferedReader(new InputStreamReader(in));
	        String line;
	        
	        while((line=br.readLine())!=null){
	        	Sequence.PutProteinSeq(line);
	        }
	        
		}
		catch (Exception e){//Catch exception if any
		      System.err.println("Error: " + e.getMessage());
		    }
		/*
		try{
			br = new BufferedReader(new FileReader(file));
			while((line = br.readLine()) != null&&LineNo<10){
				//while(LineNo<10){
					
				//LineNo = 1;
			}
		}catch(IOException e){
			e.printStackTrace();
		}finally{
			try{
				br.close();
			}catch(IOException e1){
			}
		}
	
		Sequence.Print();
}
*/

}